<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>AES-API: E:/Other/Gitee/components-examples/A01-AES/exam/aes/aes.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="gzh (2).jpg"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">AES-API
   &#160;<span id="projectnumber">V1.0.0</span>
   </div>
   <div id="projectbrief">AES-API</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.7 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('aes_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">aes.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="aes_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Advanced Encryption Standard</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * @author Dani Huertas</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * @email huertas.dani@gmail.com</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Based on the document FIPS PUB 197</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * Multiplication in GF(2^8)</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * http://en.wikipedia.org/wiki/Finite_field_arithmetic</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * Irreducible polynomial m(x) = x8 + x4 + x3 + x + 1</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * NOTE: we are using the look up table instead of the (slower) gmult function</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="aes_8h.html#a22342c953c4b0072cb2e0a8a4e686253">   19</a></span>&#160;<span class="preprocessor">#define gmult(a,b) gmult_aes[256*a + b]</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;uint8_t *<a class="code" href="aes_8h.html#a5682ceb1811499fe30fbe705877ff32c">aes_init</a>(<span class="keywordtype">size_t</span> key_size);</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keywordtype">void</span> <a class="code" href="aes_8h.html#a461739b060263bfe2888f4a47d8f5186">aes_key_expansion</a>(uint8_t *key, uint8_t *w);</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keywordtype">void</span> <a class="code" href="aes_8h.html#a73d0f24db5e8c95eaf2b6c1979188b50">aes_inv_cipher</a>(uint8_t *in, uint8_t *out, uint8_t *w);</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keywordtype">void</span> <a class="code" href="aes_8h.html#a5d8ac3ac83810baa35fa15c5e4b25303">aes_cipher</a>(uint8_t *in, uint8_t *out, uint8_t *w);</div>
<div class="ttc" id="aes_8h_html_a73d0f24db5e8c95eaf2b6c1979188b50"><div class="ttname"><a href="aes_8h.html#a73d0f24db5e8c95eaf2b6c1979188b50">aes_inv_cipher</a></div><div class="ttdeci">void aes_inv_cipher(uint8_t *in, uint8_t *out, uint8_t *w)</div><div class="ttdoc">Performs the AES inverse cipher operation. </div><div class="ttdef"><b>Definition:</b> aes.c:467</div></div>
<div class="ttc" id="aes_8h_html_a5682ceb1811499fe30fbe705877ff32c"><div class="ttname"><a href="aes_8h.html#a5682ceb1811499fe30fbe705877ff32c">aes_init</a></div><div class="ttdeci">uint8_t * aes_init(size_t key_size)</div><div class="ttdoc">Initialize AES variables and allocate memory for expanded key. </div><div class="ttdef"><b>Definition:</b> aes.c:407</div></div>
<div class="ttc" id="aes_8h_html_a461739b060263bfe2888f4a47d8f5186"><div class="ttname"><a href="aes_8h.html#a461739b060263bfe2888f4a47d8f5186">aes_key_expansion</a></div><div class="ttdeci">void aes_key_expansion(uint8_t *key, uint8_t *w)</div><div class="ttdoc">Key Expansion. </div><div class="ttdef"><b>Definition:</b> aes.c:365</div></div>
<div class="ttc" id="aes_8h_html_a5d8ac3ac83810baa35fa15c5e4b25303"><div class="ttname"><a href="aes_8h.html#a5d8ac3ac83810baa35fa15c5e4b25303">aes_cipher</a></div><div class="ttdeci">void aes_cipher(uint8_t *in, uint8_t *out, uint8_t *w)</div><div class="ttdoc">Performs the AES cipher operation. </div><div class="ttdef"><b>Definition:</b> aes.c:426</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_afe89f749343fa812f00a025feac441b.html">exam</a></li><li class="navelem"><a class="el" href="dir_b795f7569447f4537a033ae9f8381a99.html">aes</a></li><li class="navelem"><a class="el" href="aes_8h.html">aes.h</a></li>
    <li class="footer">生成于 2022年 二月 16日 星期三 07:13:25 , 为 AES-API使用 
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.7 </li>
  </ul>
</div>
</body>
</html>
